<!-- inc:frame.top -->

<div class="position"><p><!-- inc:position --> &raquo; <a href="{:$mainlink}?file=sysgroup&act=list">系统组管理</a> &raquo; {:$groupname} &raquo; 字段管理</p><!-- inc:position.fr --></div>

<div class="page_pad">
  <div class="content_add"><button class="gbutton gbutton_dblue gbutton_add" type="button" onclick="qgurl('{:$mainlink}?file=sysgroup&act=fieldadd&sysgroupid={:$sysgroupid}')">添加字段</button> <button class="gbutton gbutton_dblue gbutton_add" type="button" onclick="qgurl('{:$mainlink}?file=sysgroup&act=fieldgroup&sysgroupid={:$sysgroupid}')">字段方案管理</button> <button class="gbutton gbutton_dblue gbutton_add" type="button" onclick="qgurl('{:$mainlink}?file=sysgroup&act=fieldorder&sysgroupid={:$sysgroupid}')">字段排序</button> <button type="button" class="gbutton gbutton_add" onclick="qgurl('{:$mainlink}?file=sysgroup&act=list')">返回</button></div>
  
  <div class="content_box">
    <div class="content_bor">
      <table class="ltable">
        <tr class="first">
          <td>&nbsp;</td>
          <td>序号</td>
          <td>状态</td>
          <td>字段名称</td>
          <td>唯一标识</td>
          <td>类型</td>
          <td>是否共用参数</td>
          <td width="220">操作</td>
        </tr>
        <!-- $rowlist AS $key=>$value -->
        <tr>
          <td><input type="checkbox" name="qg_id[]" value="{:$value[id]}"></td>
          <td>{:$value[row_index]}</td>
          <td>
          <!-- if($value[ifcheck]==0) -->
          <a href="{:$mainlink}?file=sysgroup&act=fieldset&sysgroupid={:$sysgroupid}&idlist={:$value[id]}&qgtype=check"><span style="color:red;">未审核</span></a>
          <!-- elseif($value[ifcheck]==1) -->
          <a href="{:$mainlink}?file=sysgroup&act=fieldset&sysgroupid={:$sysgroupid}&idlist={:$value[id]}&qgtype=dcheck">审核</a>
          <!-- end -->
          </td>
          <td>
          <a href="{:$mainlink}?file=sysgroup&act=fieldmodify&sysgroupid={:$sysgroupid}&id={:$value[id]}">{:$value[field_name]}</a>
          </td>
          <td>{:$value[sign]}</td>
          <td>{:$value[field_type]}</td>
          <td><img style="cursor:pointer;" src="images/<!-- if($value[ifshare]==1) -->yes.png<!-- else -->cancel.png<!-- end -->" onclick="changeTableVal('sysgroup_field','id','{:$value[id]}','ifshare',this)"/></td>
          <td>
            <span><button class="gbutton" type="button" onclick="qgurl('{:$mainlink}?file=sysgroup&act=fieldmodify&sysgroupid={:$sysgroupid}&id={:$value[id]}')">编辑字段</button></span>
            <span><button class="gbutton" type="button" onclick="field('{:$mainlink}?file=sysgroup&act=fielddel&sysgroupid={:$sysgroupid}&id={:$value[id]}')">删除字段</button></span>
          </td>
        </tr>
        <!-- end -->
        <!-- run:unset($rowlist) -->
      </table>
    </div>
  </div><!--content_box-->
  
  <div class="content_ctrl">
    <button class="gbutton gbutton_min c_all" type="button" onclick="select_all()">全选</button>
    <button class="gbutton gbutton_min f_all" type="button" onclick="revCheck()">反选</button>
    <button class="gbutton gbutton_min n_all" type="button" onclick="selectNone()">全不选</button>
    <button class="gbutton gbutton_min" type="button" onclick="qg_pl('check')">审核</button>
    <button class="gbutton gbutton_min" type="button" onclick="qg_pl('dcheck')">未审核</button>
    
    <select name="act_plset" id="act_plset">
      <option value="0 ">请选择方案</option>
      <optgroup label="删除字段">
        <option value="delete">批量删除</option>
      </optgroup>
      <optgroup label="是否共用参数">
        <option value="ifshare:1">共用</option>
        <option value="ifshare:0">不共用</option>
      </optgroup>
      <optgroup label="复制字段">
        <!-- $syslist AS $key=>$value -->
        <option value="copy:{:$value[id]}" {if($value[id]==$sysgroupid)}disabled="disabled"{end}>{:$value[groupname]}</option>
        <!-- end -->
      </optgroup>
    </select>
    <button class="gbutton" type="button" onclick="update_pl()">提交</button>
  </div><!--content_ctrl-->
</div><!--page_pad-->

<script type="text/javascript">
        $(function () {
            /*把单击行时，如果行处于没选中状态，则把样式设为选中状态，当中的复选框设为选中状态；否则，移除选中状态，取消选中状态*/
            $("tbody>tr").click(function () {

                if ($(this).hasClass("selected")) {
                    $(this).removeClass("selected")
                    .find(":checkbox").attr("checked", false).prop("checked", false);
                }
                else {
                    $(this).addClass("selected")
                    .find(":checkbox").attr("checked", true).prop("checked", true);
                }
            });
			//////////////////////////////////
			$(".c_all").click(function () {
				$("tbody>tr").addClass("selected")
            });
			//////////////////////////////////
			$(".f_all").click(function () {
				$("tbody>tr").toggleClass("selected");				
            });  
			//////////////////////////////////
			$(".n_all").click(function () {
				$("tbody>tr").removeClass("selected")
            });
        });
</script>

<script>
function update_pl()
{
	var act = document.getElementById("act_plset").value;
	act_arr = act.split(":");
	if(act_arr[1])
	{
		qg_pl(act_arr[0],act_arr[1]);
	}
	else
	{
		if(act_arr[0]==0)
		{
			tip_alert("请选择方案");
			return false;
		}
		else
		{
			qg_pl(act_arr[0]);
		}
	}
}
function qg_pl(qgtype,theid)
{
	var idarray = new Array();//定义一个数组
	var cv = document.getElementsByTagName("input");
	var m = 0;
	for(var i=0; i<cv.length; i++)
	{
		if(cv[i].type.toLowerCase() == "checkbox")
		{
			if(cv[i].checked)
			{
				idarray[m] = cv[i].value;
				m++;
			}
		}
	}
	var id = idarray.join(",");
	if(!id || id == "0")
	{
		tip_alert("没有勾选要操作的主题！");
		return false;
	}
	var url;
	if(qgtype == "delete")
	{
		url = "{:$mainlink}?file=sysgroup&act=fieldset&sysgroupid={:$sysgroupid}&idlist=" + id + "&qgtype=" + qgtype;
		tip_confirm("确认删除该字段吗？特别说明，删除后无法恢复！",url);
	}
	else if(qgtype == "copy")
	{
		url = "{:$mainlink}?file=sysgroup&act=fieldset&sysgroupid={:$sysgroupid}&idlist=" + id + "&qgtype=" + qgtype + "&copyid=" + theid;
		tip_confirm("确认复制该字段吗？",url);
	}
	else if(qgtype == "ifshare")
	{
		url = "{:$mainlink}?file=sysgroup&act=fieldset&sysgroupid={:$sysgroupid}&idlist=" + id + "&qgtype=" + qgtype + "&ifshareid=" + theid;
		tip_confirm("确认修改字段吗？",url);
	}
	else
	{
		url = "{:$mainlink}?file=sysgroup&act=fieldset&sysgroupid={:$sysgroupid}&idlist=" + id + "&qgtype=" + qgtype;
		qgurl(url);
	}
}

function field(url)
{
	tip_confirm("确认删除字段吗！",url);
}
</script>

<!-- inc:frame.bottom -->